<?php

namespace App\Http\Forms;

use Illuminate\Support\Facades\DB;
use Kris\LaravelFormBuilder\Form;

class GoodCategoryForm extends Form
{
    public function buildForm()
    {
        $this
            ->add('top_category_id', 'select', [
                'label' => '顶级分类',
                'rules' => 'required|string',
                'choices' => $this->getData("top_category") ?? [],
            ])
            ->add('first_category_id', 'select', [
                'label' => '一级分类',
                'rules' => 'required|string',
                'choices' => $this->getData("first_category") ?? [],
            ])
            ->add('name', 'text', [
                'label' => "分类名称",
                'rules' => 'required|string',
            ])
            ->add('submit', 'submit', [
                'attr' => ['class' => "form-control btn btn-success"],
                'label' => '保存',
            ]);
    }
}
